#ifndef OPENGLOUTPUT_H
#define OPENGLOUTPUT_H

#include <QtOpenGL>
#include "Filter.h"

class OpenGLOutput : public QGLWidget, public Filter
{
	Q_OBJECT

public:
	enum Inputs { INPUT_DATA = 0};
	enum InputType {INPUT_TYPE_TRANSFORM, INPUT_TYPE_VECTORS, INPUT_TYPE_POINTS };

	OpenGLOutput(InputType inputType);
	~OpenGLOutput();

	//QWidget methods
	virtual QSize sizeHint() const override;
	virtual QSize minimumSizeHint() const override;
	virtual void keyPressEvent(QKeyEvent *event) override;

	//QGLWidget methods
	virtual void initializeGL() override;
	virtual void resizeGL(int width, int height) override;
	virtual void paintGL() override;

	//Filter methods
	virtual void Process() override;
	virtual void ProcessInvalid() override;
	virtual QWidget *GetOutputWidget() override;

private:
	void paintGrid();
	void paintTransform();
	void paintPoints();

	InputType inputType;

	GLfloat rotx;
	GLfloat roty;
	GLfloat posx;
	GLfloat posy;
	GLfloat posz;

	GLfloat nearPlane;
	GLfloat farPlane;
	GLfloat step;
	GLfloat gridScale;

	cv::Mat transform;
	cv::Mat points;
};

#endif // OPENGLOUTPUT_H
